const webpack = require('webpack')
module.exports = {
  /*
  ** Router config
  */
  // router: {
  //   middleware: 'check-auth'
  // },
  /*
  ** Headers of the page
  */
  head: {
    title: 'nuxtlab',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no' },
      { name: 'format-detection', content: 'telephone=no' },
      { webkit: 'renderer', content: 'webkit' },
      { hid: 'description', name: 'description', content: 'nuxt实验' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Customize the progress bar color
  */
  loading: { color: '#3B8070' },
  /*
  ** Build configuration
  */
  build: {
    loaders: [
      {
        test: /\.less$/,
        loader: "style-loader!css-loader!less-loader",
      }
    ],
    vendor: ['axios', 'jquery', 'Swiper'],
    plugins: [
      new webpack.DefinePlugin({
        $: 'jquery',
        jQuery: 'jquery',
        'window.jQuery': 'jquery'
      })
    ],
    /*
    ** Run ESLint on save
    */
    extend (config, ctx) {
      if (ctx.dev && ctx.isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        })
      }
    }
  },
  css: [
    // 加载一个 node.js 模块
    'font-awesome/css/font-awesome.css',
    // 项目中的 CSS 文件
    { src: '~assets/css/header.less', lang: 'less' },
    { src: '~assets/css/footer.less', lang: 'less' },
    { src: '~assets/css/app.less', lang: 'less' },
  ]
}
